/*
 * Copyright (c) 2020 - ~, HIT_HERO Team
 *
 * X-SPIDER APP HEAD FILE
 * Used in RT-Thread Operate System
 *
 * Change Logs:
 * Date           Author       Notes                Mail
 * 2020-12-16     WangXi       first version        WangXi_chn@foxmail.com
 */

#ifndef _APP_SENSOR_H_
#define _APP_SENSOR_H_

#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>

#include "Module_LED.h"
#include "Module_Steering.h"
#include "Module_BlueToothHC06.h"
#include "Module_OLED.h"

enum ID_STEERING
{
	L1_D1 = 0,
	L1_D2 = 1,
	L1_D3 = 2,
	L2_D1 = 3,
	L2_D2 = 4,
	L2_D3 = 5,
	L3_D1 = 6,
	L3_D2 = 7,
	L3_D3 = 8,
	L4_D1 = 9,
	L4_D2 = 10,
	L4_D3 = 11,
	ID_STEERING_END
};

enum COLOR_LED
{
	NONE = 0,
	RED = 1,
	GREEN = 2,
	BLUE = 3,
	COLOR_LED_END
};

enum ACTION
{
	REST = 1,
	DEBUG = 3,
	STAND = 5,
	GO_AHEAD = 2,
	GO_BACK = 8,
	GO_LEFT = 4,
	GO_RIGHT = 6,
	RAISEHAND = 7,
	TURE_LEFT = 10,
	TURE_RIGHT = 12,
	
	ACTION_END
};

struct _APP_XSPIDER
{
    /* Property */
	MODULE_LED 				dev_Led;
	MODULE_LED 				dev_Led_RedEye;
	MODULE_LED 				dev_Led_BlueEye;
	MODULE_LED 				dev_Led_GreenEye;
	MODULE_OLED 			dev_Oled;
	MODULE_STEERING 		dev_Steering[12];
	MODULE_BLUETOOTHHC06	dev_Controler;
	
	/* Value */
	rt_uint16_t				value_delaytic;
	enum COLOR_LED			value_eyesColor;
	enum ACTION				value_action;
	enum ACTION				value_lastaction;	
		
	/* Method */
    void (*Method_Init)(struct _APP_XSPIDER *Application);
	void (*Method_Run)(struct _APP_XSPIDER *Application);
	void (*Method_EyeChange)(struct _APP_XSPIDER *Application,enum COLOR_LED color);
	void (*Method_JointPlace)(struct _APP_XSPIDER *Application,rt_uint16_t *angle);
	
};
typedef struct _APP_XSPIDER APP_XSPIDER;

void APP_XSpider_Config(APP_XSPIDER *Application);

//Machine_ID define--------------------------------------------------------------


//Packet_ID define---------------------------------------------------------------


#endif
/************************ (C) COPYRIGHT 2020 WANGXI **************END OF FILE****/
